<?php
		require("../inc/models/contact_info_model.php");        
        if(isset($_POST['submit']))
        {        		
                $row = $_POST;
                SaveContactInfo($row);
                header("Location: index.php");                      
        }
        else
        {
                $results = GetContactInfos($_REQUEST['id']);
				$customer = GetCustomers();
				$keyword = GetContactKeywords();
        }
?>
<!DOCTYPE html>
<html lang="">
	<?php include('../inc/header.php'); ?>	
	<body>
	<?php include('../inc/navigation.php'); ?>		
	<div class="span9">
    	<div class="row-fluid">
        	<h2>Contact Info of <?=$results['contact'] ?></h2>                                        
            	<form class="well" method="post" action="#">
                	<div class="control-group">
                    	<label class="control-label" for="customer_id">Customer:</label>
                        <div class="controls">
                        	<select name="customer_id" id="customer_id">
                            	<?php while($rs = $customer->fetch_assoc()): ?>
                                <option value="<?=$rs['id'] ?>"><?=$rs['FirstName']?> <?=$rs['LastName'] ?></option>
                                <?php endwhile; ?>
                            </select>
                        </div>
                    </div>
                    <div class="control-group">
                    	<label class="control-label" for="contact">Contact:</label>
                        <div class="controls">
                        	<input type="text" name="contact" id="contact" value="<?=$results['contact']?>"/>
                        </div>
                    </div>
                    <div class="control-group">
                    	<label class="control-label" for="keyword_id">Contact Keyword:</label>
                        <div class="controls">
                        	<select name="keyword_id" id="keyword_id">
                            	<?php while($rs = $keyword->fetch_assoc()): ?>
                                <option value="<?=$rs['id'] ?>"><?=$rs['Method']?></option>
                                <?php endwhile; ?>
                            </select>
                        </div>
                    </div>
                    <input type="hidden" name="id" value="<?=$_GET['id'] ?>" />
                    <input type="submit" name="submit" value="Submit" />
                </form>
            </div>
        </div>      
    	<!-- All Bootstrap JavaScript Files -->
    	<script src="../inc/bootstrap/js/jquery.js"></script>
    	<script src="../inc/bootstrap/js/bootstrap.js"></script>        
	</body>
</html>